import { TOKEN_TIME, TOKEN_TIME_VALUE } from './constant'
import { LocalCache } from './LocalCache'
// 登录时设置时间
export const setTokenTime = (time: number) => {
  LocalCache.setitem(TOKEN_TIME, time)
}

// 获取
export const getTokenTime = () => {
  return LocalCache.getitem(TOKEN_TIME)
}

// 是否已过期
export const diffTokenTime = () => {
  const currentTime = Date.now()
  const tokenTime = getTokenTime()
  return currentTime - tokenTime > TOKEN_TIME_VALUE
}
